import { defineStore } from 'pinia'

export default defineStore('user', {
  state() {
    return {
      user: {
        id: '',
        username: '',
        password: '',
        email: '',
        phoneNumber: '',
        fullName: '',
        sex: '',
        registrationDate: "",
        lastLogin: "",
        isRoot: ""
      }
    }
  },
  actions: {
    setUser(user) {
      this.user = user
    },
    clearUser() {
      sessionStorage.clear()
      this.user = {
        username: ''
      }
    }
  },

  persist:true
})
